package com.elitesland.b2c.com.repo;

import com.elitesland.b2c.com.entity.ComFileDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author shihao.ma
 * @since 2020/6/16
 */
public interface ComFileRepo extends JpaRepository<ComFileDO, Long>, QuerydslPredicateExecutor<ComFileDO> {

//    ComFileDO findByFileCode(String fileCode);
//
//    List<ComFileDO> findByFileCodeIn(List<String> fileCodeList);
//
//    List<ComFileDO> findByOrderCode(String orderCode);
//
//    @Transactional
//    @Modifying
//    @Query(value = "UPDATE com_file_upload_info f SET f.deleted = 1 WHERE f.file_code = ?1", nativeQuery = true)
//    Integer deleteFile(String fileCode);
//
//    @Transactional
//    @Modifying
//    @Query(value = "UPDATE com_file_upload_info f SET f.deleted = 1 WHERE f.group_flag = ?1", nativeQuery = true)
//    Integer deleteGroupFlag(String groupFlag);

    /**
     * 根据ID批量删除
     *
     * @param ids ID
     * @return
     */
    int deleteAllByIdIn(List<Long> ids);
}
